import { domainService } from '~/config/server'
import { NetService } from '~/utils/net.service'
import { Inject, Debounce } from "~/core/decorator";
import { FilterService } from '~/utils/filter.service';

export class RobCaseService {

  @Inject(NetService)
  private netService: NetService

  /**
   * 获取抢案案件数据
   */
  public robCasesQuery(data, page?, sort?) {
    return this.netService.send({
      server: domainService.robCaseController.robCasesQuery,
      data:{
        caseNumber:data.caseNumber,   // 借据号
        personalName:data.personalName,  // 客户姓名
        mobileNo:data.mobileNo,     // 联系电话
        idCard:data.idCard,       // 身份证号
        deptId:data.deptIds.length === 0?'':data.deptIds[data.deptIds.length-1],      // 机构
        // area: data.area[data.area.length - 1],       // 地区
        provinceId: data.area[0],
        cityId: data.area[1],
        countyId: data.area[2],
        currentCollectorRealName:data.currentCollectorRealName, // 催收员
        customerCategory: data.customerCategory,   // 客户类型
        overdueAmountMax: data.overdueAmount.max,  // 案件金额
        overdueAmountMin: data.overdueAmount.min,  
        overduePeriod:data.overduePeriod,   // 逾期阶段
        overdueDaysMax: data.overdueDays.max, // 逾期天数
        overdueDaysMin: data.overdueDays.min,
        followupBack:data.followupBack,    // 行动代码
        turnSource:data.turnSource,      // 流转来源
        sysCode:data.sysCode,  // 系统来源
        productName:data.productName,     // 产品名称
        followInTimeMin: FilterService.dateRanageFormat(data.followInTime).start, // 案件流入时间
        followInTimeMax: FilterService.dateRanageFormat(data.followInTime).end,
        
      },
      page,
      sort
    })
  }
  /**
   * 获取抢案案件跟进记录
   */
  public queryFollowupRecords(data, page?, sort?) {
    return this.netService.send({
      server: domainService.robCaseController.queryFollowupRecords,
      data:{
        caseId:data 
      },
      page,
      sort
    })
  }
  /**
   * 抢案--分案
   * @param data 
   */
  public distributeRobCase(data) {
    return this.netService.send({
      server: domainService.robCaseController.distributeRobCase,
      data,
      loading: true
    })
  }


}
